package com.qingyun.house.api.utils;

import java.io.File;
import java.io.IOException;
import java.time.Instant;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import com.google.common.io.Files;

public class FileUtil {


    /**
     * 保存文件到本地
     * @param file
     * @param filePath
     * @return
     * @throws IOException
     */
//    public static File saveToLocal(MultipartFile file, String filePath) throws IOException {  //@RequestParam
//        File newfile = new File(filePath + "/" + Instant.now().getEpochSecond() + "/" + file.getOriginalFilename());
//        if (!newfile.exists()) {
//            newfile.getParentFile().mkdirs();
//            newfile.createNewFile();
//        }
//        Files.write(file.getBytes(), newfile);
//        return newfile;
//    }

}
